package com.chenfan.mapper;

import com.chenfan.pojo.Sum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface SumMapper {
    @Update("update lib set count=(count-1) where bookid=#{bookid} ")
    void add(Integer bookid);
    @Update("update lib set count=(count+1) where bookid=#{bookid} ")
    void take(Integer id);

//    @Select("select book.* from lib,book where book.id=lib.bookid order by count")
//    List<Sum> total();
    @Select("select book.* from lib,book where book.id=lib.bookid order by count")
    List<Sum> list();
}
